// SEQGAME
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define max 100000

vector<int> b, c;
int n, res = 2000000001;

void inp()
{
    cin >> n;
    int x;
    
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        b.push_back(x);
    }    
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        c.push_back(x);
    }
}
 
void initialise()
{
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());    
}
 
void process()
{
    initialise();
    int j = n-1;
    for (int i = 0; i < n; i++)
    {
        while (j >= 0)
            if ((j > 0) && (abs(b[i]+c[j-1]) <= abs(b[i]+c[j]))) j--;
            else break;
        res = min(res, abs(b[i]+c[j]));
    }
}

void out()
{
    cout << res << endl;
}
 
int main()
{
    freopen("SEQGAME.INP", "r", stdin);
    freopen("SEQGAME.OUT", "w", stdout);
    
    inp();
    process();
    out();        
    return 0;
}
